package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_transaction_purchase_order")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findAll", query = "SELECT t FROM PosTransactionPurchaseOrder t"),
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findBySync", query = "SELECT t FROM PosTransactionPurchaseOrder t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findByPurchaseOrderId", query = "SELECT t FROM PosTransactionPurchaseOrder t WHERE t.purchaseOrderId = :purchaseOrderId"),
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findByPurchaseOrderNumber", query = "SELECT t FROM PosTransactionPurchaseOrder t WHERE t.purchaseOrderNumber = :purchaseOrderNumber"),
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findByPurchaseOrderDate", query = "SELECT t FROM PosTransactionPurchaseOrder t WHERE t.purchaseOrderDate = :purchaseOrderDate"),
//    @NamedQuery(name = "PosTransactionPurchaseOrder.findByPurchaseOrderTimestamt", query = "SELECT t FROM PosTransactionPurchaseOrder t WHERE t.purchaseOrderTimestamp = :purchaseOrderTimestamt")})
public class PosTransactionPurchaseOrder implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "purchase_order_id")
    private Integer purchaseOrderId;
    @Basic(optional = false)
    @Column(name = "purchase_order_number")
    private String purchaseOrderNumber;
    @Basic(optional = false)
    @Column(name = "purchase_order_date")
    @Temporal(TemporalType.DATE)
    private Date purchaseOrderDate;
    @Basic(optional = false)
    @Lob
    @Column(name = "purchase_order_description")
    private String purchaseOrderDescription;
    @Basic(optional = false)
    @Column(name = "purchase_order_status")
    private String purchaseOrderStatus;
    @Basic(optional = false)
    @Column(name = "purchase_order_keel")
    private String purchaseOrderKeel;
    @Basic(optional = false)
    @Column(name = "purchase_order_total_quantity")
    private Integer purchaseOrderTotalQuantity;
    @Basic(optional = false)
    @Column(name = "purchase_order_total")
    private BigDecimal purchaseOrderTotal;
    @Basic(optional = false)
    @Column(name = "purchase_order_paid")
    private BigDecimal purchaseOrderPaid;
    @Basic(optional = false)
    @Column(name = "purchase_order_retur_quantity")
    private Integer purchaseOrderReturQuantity;
    @Basic(optional = false)
    @Column(name = "purchase_order_retur_total")
    private BigDecimal purchaseOrderReturTotal;
    @Basic(optional = false)
    @Column(name = "purchase_order_received")
    private Integer purchaseOrderReceived;
    @Column(name = "purchase_order_unreceived")
    private Integer purchaseOrderUnreceived;
    @Basic(optional = false)
    @Column(name = "purchase_order_progress")
    private String purchaseOrderProgress;
    @Basic(optional = false)
    @Column(name = "purchase_order_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date purchaseOrderTimestamp;
    @JoinColumn(name = "purchase_order_user_id", referencedColumnName = "user_id")
    @OneToOne
    private MasterUser purchaseOrderUserId;
    @JoinColumn(name = "purchase_order_unit_id", referencedColumnName = "unit_id")
    @OneToOne
    private MasterUnit purchaseOrderUnitId;
    @JoinColumn(name = "purchase_order_supplier_id", referencedColumnName = "supplier_id")
    @OneToOne
    private PosMasterSupplier purchaseOrderSupplierId;
    @JoinColumn(name = "purchase_order_supplier_model_id", referencedColumnName = "supplier_model_id")
    @OneToOne
    private PosMasterSupplierModel purchaseOrderSupplierModelId;

    public PosTransactionPurchaseOrder() {
    }

    public PosTransactionPurchaseOrder(Integer purchaseOrderId) {
        this.purchaseOrderId = purchaseOrderId;
    }

    public PosTransactionPurchaseOrder(Integer purchaseOrderId, String purchaseOrderNumber, Date purchaseOrderDate, String purchaseOrderStatus, String purchaseOrderDescription, Date purchaseOrderTimestamp) {
        this.purchaseOrderId = purchaseOrderId;
        this.purchaseOrderNumber = purchaseOrderNumber;
        this.purchaseOrderDate = purchaseOrderDate;
        this.purchaseOrderDescription = purchaseOrderDescription;
        this.purchaseOrderTimestamp = purchaseOrderTimestamp;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getPurchaseOrderUnreceived() {
        return purchaseOrderUnreceived;
    }

    public void setPurchaseOrderUnreceived(Integer purchaseOrderUnreceived) {
        this.purchaseOrderUnreceived = purchaseOrderUnreceived;
    }

    public Integer getPurchaseOrderId() {
        return purchaseOrderId;
    }

    public void setPurchaseOrderId(Integer purchaseOrderId) {
        this.purchaseOrderId = purchaseOrderId;
    }

    public PosMasterSupplier getPurchaseOrderSupplierId() {
        return purchaseOrderSupplierId;
    }

    public void setPurchaseOrderSupplierId(PosMasterSupplier purchaseOrderSupplierId) {
        this.purchaseOrderSupplierId = purchaseOrderSupplierId;
    }

    public MasterUnit getPurchaseOrderUnitId() {
        return purchaseOrderUnitId;
    }

    public void setPurchaseOrderUnitId(MasterUnit purchaseOrderUnitId) {
        this.purchaseOrderUnitId = purchaseOrderUnitId;
    }

    public MasterUser getPurchaseOrderUserId() {
        return purchaseOrderUserId;
    }

    public void setPurchaseOrderUserId(MasterUser purchaseOrderUserId) {
        this.purchaseOrderUserId = purchaseOrderUserId;
    }

    public String getPurchaseOrderStatus() {
        return purchaseOrderStatus;
    }

    public void setPurchaseOrderStatus(String purchaseOrderStatus) {
        this.purchaseOrderStatus = purchaseOrderStatus;
    }

    public Integer getPurchaseOrderTotalQuantity() {
        return purchaseOrderTotalQuantity;
    }

    public void setPurchaseOrderTotalQuantity(Integer purchaseOrderTotalQuantity) {
        this.purchaseOrderTotalQuantity = purchaseOrderTotalQuantity;
    }

    public Integer getPurchaseOrderReturQuantity() {
        return purchaseOrderReturQuantity;
    }

    public void setPurchaseOrderReturQuantity(Integer purchaseOrderReturQuantity) {
        this.purchaseOrderReturQuantity = purchaseOrderReturQuantity;
    }

    public Integer getPurchaseOrderReceived() {
        return purchaseOrderReceived;
    }

    public void setPurchaseOrderReceived(Integer purchaseOrderReceived) {
        this.purchaseOrderReceived = purchaseOrderReceived;
    }

    public String getPurchaseOrderProgress() {
        return purchaseOrderProgress;
    }

    public void setPurchaseOrderProgress(String purchaseOrderProgress) {
        this.purchaseOrderProgress = purchaseOrderProgress;
    }

    public String getPurchaseOrderNumber() {
        return purchaseOrderNumber;
    }

    public void setPurchaseOrderNumber(String purchaseOrderNumber) {
        this.purchaseOrderNumber = purchaseOrderNumber;
    }

    public Date getPurchaseOrderDate() {
        return purchaseOrderDate;
    }

    public void setPurchaseOrderDate(Date purchaseOrderDate) {
        this.purchaseOrderDate = purchaseOrderDate;
    }

    public String getPurchaseOrderDescription() {
        return purchaseOrderDescription;
    }

    public void setPurchaseOrderDescription(String purchaseOrderDescription) {
        this.purchaseOrderDescription = purchaseOrderDescription;
    }

    public Date getPurchaseOrderTimestamp() {
        return purchaseOrderTimestamp;
    }

    public void setPurchaseOrderTimestamp(Date purchaseOrderTimestamp) {
        this.purchaseOrderTimestamp = purchaseOrderTimestamp;
    }

    public BigDecimal getPurchaseOrderTotal() {
        return purchaseOrderTotal;
    }

    public void setPurchaseOrderTotal(BigDecimal purchaseOrderTotal) {
        this.purchaseOrderTotal = purchaseOrderTotal;
    }

    public BigDecimal getPurchaseOrderPaid() {
        return purchaseOrderPaid;
    }

    public void setPurchaseOrderPaid(BigDecimal purchaseOrderPaid) {
        this.purchaseOrderPaid = purchaseOrderPaid;
    }

    public BigDecimal getPurchaseOrderReturTotal() {
        return purchaseOrderReturTotal;
    }

    public void setPurchaseOrderReturTotal(BigDecimal purchaseOrderReturTotal) {
        this.purchaseOrderReturTotal = purchaseOrderReturTotal;
    }

    public PosMasterSupplierModel getPurchaseOrderSupplierModelId() {
        return purchaseOrderSupplierModelId;
    }

    public void setPurchaseOrderSupplierModelId(PosMasterSupplierModel purchaseOrderSupplierModelId) {
        this.purchaseOrderSupplierModelId = purchaseOrderSupplierModelId;
    }

    public String getPurchaseOrderKeel() {
        return purchaseOrderKeel;
    }

    public void setPurchaseOrderKeel(String purchaseOrderKeel) {
        this.purchaseOrderKeel = purchaseOrderKeel;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (purchaseOrderId != null ? purchaseOrderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionPurchaseOrder)) {
            return false;
        }
        PosTransactionPurchaseOrder other = (PosTransactionPurchaseOrder) object;
        if ((this.purchaseOrderId == null && other.purchaseOrderId != null) || (this.purchaseOrderId != null && !this.purchaseOrderId.equals(other.purchaseOrderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return purchaseOrderNumber;
        //        return "com.buanalintas.sandals.pos.entities.PosTransactionPurchaseOrder[ purchaseOrderId=" + purchaseOrderId + " ]";
    }
}
